package java01_type;

import org.junit.jupiter.api.Test;

import java.util.List;

public class Test07_DefaultValue {
    /**
     * Bean里的字段，应该用包装类
     */
    @Test
    void testDefaultValue() {
        User user = new User();
        System.out.println(user);

        UserNew userNew = new UserNew();
        System.out.println(userNew);
    }

    public class User {
        //默认值为0
        int age;
        //默认值为false
        boolean flag;

        @Override
        public String toString() {
            return "User{" +
                    "age=" + age +
                    ", flag=" + flag +
                    '}';
        }
    }

    public class UserNew {
        //默认值为null
        Integer age;
        Boolean flag;
        List<String> names;

        @Override
        public String toString() {
            return "UserNew{" +
                    "age=" + age +
                    ", flag=" + flag +
                    ", names=" + names +
                    '}';
        }
    }
}
